const argv = require('yargs').argv
let proxyList = { // 正式环境
  '/api/': {
      target: 'https://api.douban.com',  // 接口域名
      changeOrigin: true,  //是否跨域
      pathRewrite: {
          '^/api/admin': '/v2/movie'   //需要rewrite重写的
      }
  }
}

if(argv.env && argv.env === 'mock') {
  proxyList = { // mock接口
    '/api/': {
        target: 'http://localhost:3004', 
        changeOrigin: true,
        pathRewrite: {
            '^/api/admin': '/api/admin'
        }
    }
  }
}

module.exports = {
  proxyList: proxyList 
}
